<?php
if(!empty($sub_cat_id)){

if(count(get_category($sub_cat_id))){
?>
<div id="box-mn-head">

        <div id="boxcate" align="left">
            <table class="tblCate" cellspacing="0" id="sub_cat_list">
                <tbody><tr>
                    <td width="25%" valign="top" class="cateItem">
                        <div style="margin:10px 10px 0 10px">
                            <?php
                            foreach(get_category($sub_cat_id) as $key=>$val){
                               if( $key<5){
                            ?>
                            <a href="<?php echo  get_post_list_url($this->province_id,$category_id,$sub_cat_id,$val['id']); ?>"><h2 <?php if($val['id']==$child_cat_id){ echo "class='active'";} ?>><?php echo $val['name'] ?></h2></a>
                            <?php }}?>
                        </div>
                    </td>
                    <td width="25%" valign="top" class="cateItem">
                        <div style="margin:10px 10px 0 10px">
                            <?php
                            foreach(get_category($sub_cat_id) as $key=>$val){
                                    if($key>4 && $key<10){
                            ?>
                                    <a href="<?php echo  get_post_list_url($this->province_id,$category_id,$sub_cat_id,$val['id']); ?>" <?php if($val['id']==$child_cat_id){ echo "class='active'";} ?>><h2><?php echo $val['name'] ?></h2></a>
                            <?php }}?>
                        </div>
                    </td>
                    <td width="25%" valign="top" class="cateItem">
                        <div style="margin:10px 10px 0 10px">
                            <?php
                            foreach(get_category($sub_cat_id) as $key=>$val){
                                if($key>9 && $key<15){
                                    ?>
                                    <a href="<?php echo  get_post_list_url($this->province_id,$category_id,$sub_cat_id,$val['id']); ?>" <?php if($val['id']==$child_cat_id){ echo "class='active'";} ?>><h2><?php echo $val['name'] ?></h2></a>
                                    <?php }}?>
                        </div>
                    </td>
                    <td width="25%" valign="top" class="cateItem">
                        <div style="margin:10px 10px 0 10px">
                            <?php
                            foreach(get_category($sub_cat_id) as $key=>$val){
                                if($key>14 && $key<20){
                                    ?>
                                    <a href="<?php echo  get_post_list_url($this->province_id,$category_id,$sub_cat_id,$val['id']); ?>" <?php if($val['id']==$child_cat_id){ echo "class='active'";} ?>><h2><?php echo $val['name'] ?></h2></a>
                                    <?php }}?>
                        </div>
                    </td>
                </tr>
                </tbody></table>
            <div id="cat_back_detail"></div>
        </div>

</div>
<?php }}  ?>
